package org.yelongframework.servlet;

import java.io.ByteArrayOutputStream;
import java.io.IOException;

import javax.servlet.ServletOutputStream;
import javax.servlet.WriteListener;

/**
 * 字节数组的输出流
 * 
 * @since 1.0.0
 */
public class ByteArrayServletOutputStream extends ServletOutputStream {

	/** 输出流 */
	private ByteArrayOutputStream outputStream;

	/**
	 * @param outputStream 输出流
	 */
	public ByteArrayServletOutputStream(ByteArrayOutputStream outputStream) {
		this.outputStream = outputStream;
	}

	@Override
	public void write(int b) throws IOException {
		outputStream.write(b);
	}

	@Override
	public boolean isReady() {
		return false;
	}

	@Override
	public void setWriteListener(WriteListener arg0) {

	}

	public ByteArrayOutputStream getOutputStream() {
		return outputStream;
	}

}
